class ActivityTypeController < ApplicationController
layout "normal"

def edit
 @activity_type = ActivityType.find(params[:id])
 render :partial=>'activity_type/edit_item'
end

def update 
  @atype = ActivityType.find(params[:activity_type][:id])
  @atype.name=params[:activity_type][:name]
  @atype.save
  render :partial=>'activity_type/show_item'
end

def save 
  @atype = ActivityType.new(params[:activity_type])
  @atype.company = session[:user].company
  @atype.save
  render :update do |page|
    page.replace_html 'activity_types',:partial=>'project/activity_type'
    page.visual_effect :highlight,'activity_item_' + @atype.id.to_s,:duration=>4.5
  end
end

def destroy
  @atype = ActivityType.find(params[:id])
  @atype.destroy
  render :update do |page|
    page.visual_effect :highlight,'activity_item_' + @atype.id.to_s,:duration=>4.5
    page.replace_html 'activity_types',:partial=>'project/activity_type'
  end
end

def new
  render :partial=>'activity_type/new_item'
end
end
